/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ideastec.mipyme.persistence.paginaweb;

import java.util.List;

import com.ideastec.mipyme.model.paginaweb.PaginaWeb;
import com.ideastec.mipyme.persistence.DAOPadre;
import com.ideastec.mipyme.repository.paginaweb.RepositorioPaginaWeb;

/**
 *
 * @author Diego Rafael Graf
 */

public class DAOPaginaWeb extends DAOPadre<PaginaWeb> implements RepositorioPaginaWeb{
    
    @Override 
    protected Class<PaginaWeb> getClase(){
        return PaginaWeb.class;
    }
    
    @Override
    public List<PaginaWeb> buscarTodos() throws Exception{
        try{
            return this.getHibernateTemplate().find("from " + persistentClass.getName() + " order by paginaweb asc");
        }
        catch(Exception e){
            throw new Exception(e);
        }
    }    
    
    @Override
    public List<PaginaWeb> buscarPaginaWeb(PaginaWeb paginaweb) throws Exception{
        try{
            return this.getHibernateTemplate().find("from " + persistentClass.getName() + " where paginaweb = '" + paginaweb.getPaginaweb() + "'");
        }
        catch(Exception e){
            throw new Exception(e);
        }
    }
    
}
